<template>
	<view class="news" >
	<news-item :list="newsList" @itemClick="goDetail" ></news-item>
	
	</view>
</template>

<script>
import newsItem from '../components/news-item/news-item.vue'
	export default {
		data() {
			return {
			newsList: []	
			}
		},
			
		components:{
		"news-item"	: newsItem
		},
		methods: {
		async	getNews(){
				const res = await this.$myRuquest({
				url: '/api/getnewslist'
				})
				this.newsList = res.data.message
			},
			goDetail(id){
				uni.navigateTo({
				url: '/pages/news-detail/news-detail?id='+id
				})
			}
		},
		onLoad(){
			this.getNews()
		}
	}
</script>

<style lang="scss">
	.news{
		.news_item{
			display: flex;
			padding: 10rpx 20rpx;
			border-bottom: 1px solid #b50e03;
			image{
			   min-width: 200rpx;
			   max-width: 200rpx;
				height: 150rpx;
			}
			.right{
			     margin-left: 15rpx;
				 display:flex;
				 flex-direction: column;
				 justify-content: space-between;
				.tit{
				font-size: 30rpx;
				}
				.info{
					font-size: 24rpx;	
					text:nth-child(2){
						margin-left: 30rpx;
					}
				}
			}
		}
	}

</style>
